<?php include "header.html"; ?>

<body>
  <div class="zss-wrap">

    <div class="zss-header">
      <span class="layui-breadcrumb">
        <?= $this->get_loc($this->baseClass, "列表"); ?>
      </span>
    </div>

    <div class="zss-nav">
      <a type="button" class="layui-btn" href="?cid=0">
        <i class="layui-icon">&#xe608;</i> 添加分类
      </a>
    </div>
    

    <div class="zss-content">
    
      <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
          <li class="layui-this">分类管理</li>
        </ul>
        <div class="layui-tab-content">
          <div class="layui-tab-item layui-show">
            <div class="layui-tab-fluid">  
              <div class="layui-row">
                <div class="layui-col-md4">
                  
                  <div class="layui-tree layui-tree-line" lay-filter="LAY-tree-2">
                    <?= $this->recursive_menu(); ?>
                  </div>
                  
                </div>
                <div class="layui-col-md8" style="padding-left: 20px;border-left:1px solid #e6e6e6;">
                  
                  <?php if($global["cid"] != '') { ?>
                    <fieldset class="layui-elem-field layui-field-title">
                      <legend style="margin: auto;">编辑分类</legend>
                    </fieldset>
                    <form action="<?= U('category/submit') ?>" method="post" class="layui-form">
                      <div class="layui-form-item">
                        <label class="layui-form-label">所属类别</label>
                        <div class="layui-input-block">
                          <select name="category_cid" lay-verify="required">
                            <option value="0" <?php if(0 == $global["cid"]) { ?>selected<?php } ?>>一级分类</option>
                            <?php $this->recursive_category_select(0, $global["cid"], '', 1); ?>
                          </select>
                        </div>
                      </div>

                      <div class="layui-form-item">
                        <label class="layui-form-label">分类名称</label>
                        <div class="layui-input-block">
                          <input type="text" name="category_name"  lay-verify="required" placeholder="请输入分类名称" autocomplete="off" class="layui-input" value="<?= $result['category_name'] ?>">
                        </div>
                      </div>

                      <div class="layui-form-item">
                        <label class="layui-form-label">分类别名</label>
                        <div class="layui-input-block">
                          <input type="text" name="category_alias" placeholder="请输入分类名称" autocomplete="off" class="layui-input" value="<?= $result['category_alias'] ?>">
                        </div>
                      </div>

                      <div class="layui-form-item">
                        <label class="layui-form-label">自定义路径</label>
                        <div class="layui-input-block">
                          <input type="text" name="category_path" placeholder="自定义路径" autocomplete="off" class="layui-input" value="<?= $result['category_path'] ?>">
                        </div>
                      </div>

                      <div class="layui-form-item">
                        <label class="layui-form-label">分类描述</label>
                        <div class="layui-input-block">
                          <textarea name="category_description" placeholder="分类描述" class="layui-textarea"><?= $result['category_description'] ?></textarea>
                        </div>
                      </div>

                      <div class="layui-form-item" style="display: none;">
                        <label class="layui-form-label">分类详情</label>
                        <div class="layui-input-block" style="background: #f7f7f7; padding: 10px; border: 1px solid #e6e6e6;">
                          <?php kindeditor("content1", "category_content", kindhtml($result['category_content'])) ?> 
                        </div>
                      </div>

                      <div class="layui-form-item" style="display: none;">
                        <label class="layui-form-label">内容图片</label> 
                        <div class="layui-input-block">
                          <?php $this->get_upload_image("pic1", "pic", $result['category_pic']); ?>
                        </div>
                      </div>

                      <div class="layui-form-item" style="display: none;">
                        <label class="layui-form-label">前端模板</label>
                        <div class="layui-input-block">
                          <input name="category_templates" type="text" value="<?= $result['category_templates'] ?>" autocomplete="off" class="layui-input">
                        </div>
                      </div>

                      <div class="layui-form-item">
                        <label class="layui-form-label">后台模板</label>
                        <div class="layui-input-block">
                          <input name="category_admin_templates" type="text" value="<?= $result['category_admin_templates'] ?>" autocomplete="off" class="layui-input">
                        </div>
                      </div>
    
                      <div class="layui-form-item">
                        <label class="layui-form-label">SEO标题</label>
                        <div class="layui-input-block">
                          <input type="text" name="category_seo_title" placeholder="SEO标题" autocomplete="off" class="layui-input" value="<?= $result['category_seo_title'] ?>">
                        </div>
                      </div>
  
                      <div class="layui-form-item">
                        <label class="layui-form-label">SEO关键字</label>
                        <div class="layui-input-block">
                          <input type="text" name="category_seo_keywords" placeholder="SEO关键字" autocomplete="off" class="layui-input" value="<?= $result['category_seo_keywords'] ?>">
                        </div>
                      </div>
  
                      <div class="layui-form-item">
                        <label class="layui-form-label">SEO描述</label>
                        <div class="layui-input-block">
                          <textarea name="category_seo_description" placeholder="SEO描述" class="layui-textarea"><?= $row['category_seo_description'] ?></textarea>
                        </div>
                      </div>
  
                      <div class="layui-form-item" style="display: none;">
                        <label class="layui-form-label">每页数量</label>
                        <div class="layui-input-block">
                          <input type="text" name="category_pagecount" placeholder="" autocomplete="off" class="layui-input" value="<?= $result['category_pagecount'] ?>">
                        </div>
                      </div>
  
                      <div class="layui-form-item">
                        <label class="layui-form-label">独立地址</label>
                        <div class="layui-input-block">
                          <input type="text" name="category_url" placeholder="" autocomplete="off" class="layui-input" value="<?= $result['category_url'] ?>">
                        </div>
                      </div>

                      <div class="layui-form-item" pane>
                        <label class="layui-form-label">打开方式</label>
                        <div class="layui-input-block">
                            <input type="radio" name="category_target" value="0" title="当前窗口" <?php if($result['category_target'] == 0) { echo 'checked'; }?>>
                            <input type="radio" name="category_target" value="1" title="新窗口" <?php if($result['category_target'] == 1) { echo 'checked'; }?>>    
                        </div>
                      </div>

                      <div class="layui-form-item">
                        <label class="layui-form-label">排序权重</label>
                        <div class="layui-input-block">
                          <input type="text" name="category_order" placeholder="" autocomplete="off" class="layui-input" value="<?= $result['category_order'] ?>">
                        </div>
                      </div>

                      <div class="layui-form-item" pane>
                        <label class="layui-form-label">内容维护</label>
                        <div class="layui-input-block">
                            <input type="radio" name="category_add" value="1" title="是" <?php if($result['category_add'] == 1) { echo 'checked'; }?>>
                            <input type="radio" name="category_add" value="0" title="否" <?php if($result['category_add'] == 0) { echo 'checked'; }?>>    
                        </div>
                      </div>

                      <div class="layui-form-item" pane>
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-block">
                            <input type="radio" name="category_state" value="1" title="显示" <?php if($result['category_state'] == 1) { echo 'checked'; }?>>
                            <input type="radio" name="category_state" value="0" title="隐藏" <?php if($result['category_state'] == 0) { echo 'checked'; }?>>    
                        </div>
                      </div>

                      <div class="layui-form-item">
                        <div class="layui-input-block">
                          <input type="hidden" value="<?=$global['id'];?>" name="id" />
                          <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                        </div>
                      </div>
                                        
                    </form>
                  <?php }?>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>  
    </div>

  </div>

  <script>
    layui.use(['element', 'form']);
  </script>
</body>
</html>